﻿<!DOCTYPE html>
<html ng-app="demoApp" lang="en">
<head>
    <title id='Description'>The AngularJS ListBox widget supports multiple selection. You can enable this functionality by setting the 'multiple' property to true.
    </title>
    <meta name="description" content="AngularJS ListBox example. This example demonstrates a ListBox with multi-items selection." /> 
    <link rel="stylesheet" href="../../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../../scripts/angular.min.js"></script> <script type="text/javascript" src="../../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../../scripts/demos.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxangular.js"></script>

    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function ($scope) {
            var source = [
                  "Affogato",
                  "Americano",
                  "Bicerin",
                  "Breve",
                  "Café Bombón",
                  "Café au lait",
                  "Caffé Corretto",
                  "Café Crema",
                  "Caffé Latte",
                  "Caffé macchiato",
                  "Café mélange",
                  "Coffee milk",
                  "Cafe mocha",
                  "Cappuccino",
                  "Carajillo",
                  "Cortado",
                  "Cuban espresso",
                  "Espresso",
                  "Eiskaffee",
                  "The Flat White",
                  "Frappuccino",
                  "Galao",
                  "Greek frappé coffee",
                  "Iced Coffee﻿",
                  "Indian filter coffee",
                  "Instant coffee",
                  "Irish coffee",
                  "Liqueur coffee"
            ];

            $scope.listBox = {};
            // display selected List Items.
            var displaySelectedItems = function () {
                var items = $scope.listBox.getSelectedItems();
                var selection = "Selected Items: ";
                for (var i = 0; i < items.length; i++) {
                    selection += items[i].label + (i < items.length - 1 ? ", " : "");
                }
                $scope.log = selection;
            }

            // Create a jqxListBox
            $scope.settings = {
                created: function (args) {
                    $scope.listBox = args.instance;
                    displaySelectedItems();
                    $scope.change = function (event) {
                        displaySelectedItems();
                    };
                },
                source: source, selectedIndex: 1, multiple: true, width: 200, height: 250
            };
        });
    </script>
</head>
<body ng-controller="demoController">
    <jqx-list-box jqx-on-change="change(event)" jqx-settings="settings"></jqx-list-box>
    {{log}}
</body>
</html>
